/*
day386 
2020.9.17 
*/ 
#include<iostream>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
 

class Solution {
public:
    vector<int> arrayRankTransform(vector<int>& arr) {
    	if(arr.empty())
		{
			return arr;
		 } 
    	
		vector<int> tem(arr);
		sort(tem.begin(),tem.end());
		map<int,int> m;
		
		int count=1;
		m[tem[0]]=1;
		
		for(int i=1;i<tem.size();++i)
		{
			if(tem[i]>tem[i-1])
			{
				count++;
			}
			m[tem[i]]=count;
		}
		
		for(int i=0;i<arr.size();++i)
		{
			arr[i]=m[arr[i]];
		}
		
		return arr;
    }
};

int main()
{
	return 0;
}
